package algorithm.dynamic_programming;

public class Hanoi {
    public static int hanoi2(int n){
       // int[] a = {0};
        if(n > 0){
             return process(n, "left", "right", "mid");

        }
        return 0;
    }

    public static int process(int n, String from, String to, String other){
        if(n == 1){
            System.out.println("Move 1 from " + from + " to " + to);
            return 1;
        }else{
            int process1 = process(n - 1, from, other, to);
            int process2 = process(1, from, to, other);
            int process3 = process(n - 1, other, to, from);
            return process1 + process2 + process3;
        }
    }

    public static void main(String[] args) {
        int i = hanoi2(3);
        System.out.println(i);
    }
}
